<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{$CONF['shopTitle']['fieldValue']}后台管理中心</title>
    <link href="__PUBLIC__/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="__CSS__/AdminLTE.css" rel="stylesheet" type="text/css" />
    <link href="__CSS__/upload.css" rel="stylesheet" type="text/css" />

    <!--[if lt IE 9]>
    <script src="__PUBLIC__/js/html5shiv.min.js"></script>
    <script src="__PUBLIC__/js/respond.min.js"></script>
    <![endif]-->
    <script src="__PUBLIC__/js/jquery.min.js"></script>
    <script src="__PUBLIC__/plugins/bootstrap/js/bootstrap.min.js"></script>
    <script src="__PUBLIC__/js/common.js"></script>
    <script src="__PUBLIC__/plugins/plugins/plugins.js"></script>

    <script src="__PUBLIC__/plugins/formValidator/formValidator-4.1.3.js"></script>
    <script type="text/javascript" src="__JS__/upload.js"></script>

</head>
<script>
    var ThinkPHP = window.Think = {
        "ROOT"   : "__ROOT__"
    }
    $(function () {
        $.formValidator.initConfig({
            theme:'Default',mode:'AutoTip',formID:"myform",debug:true,submitOnce:true,onSuccess:function(){
                editMoney();
                return false;
            }});


    });
    function editMoney(){
        var params = {};
        params.userId = $('#userId').val();
        params.userType = $("#userType").val();
        params.userMoney = $('#userMoney').val();
        params.addMoney = $('#addMoney').val();
        params.ReduceMoney = $('#ReduceMoney').val();
        if(isNaN(params.addMoney) || isNaN(params.ReduceMoney))
        {
            alert("不是数字类型!");
            return false;
        }

        if(params.addMoney != '' && params.ReduceMoney!= '')
        {
            alert('只能填写其中一项');
            return false;
        }
       /* if(params.addMoney == '' )
        {
            params.userMoney =  Number(params.userMoney) - Number(params.ReduceMoney);
        }else if(params.ReduceMoney == '')
        {
            params.userMoney = Number(params.userMoney) + Number(params.addMoney);
        }
*/
        Plugins.waitTips({title:'信息提示',content:'正在提交数据，请稍后...'});
        $.post("{:U('Admin/Users/editMoney')}",params,function(data,textStatus){
            var json = WST.toJson(data);
            if(json.status=='1'){
                Plugins.setWaitTipsMsg({ content:'操作成功',timeout:1000,callback:function(){
                    location.href='{:U("Admin/Users/index")}';
                }});
            }else{
                Plugins.closeWindow();
                Plugins.Tips({title:'信息提示',icon:'error',content:'操作失败!',timeout:1000});
            }
        });
    }
    var filetypes = ["gif","jpg","png","jpeg"];
</script>
<body class="wst-page">
<form name="myform" method="post" id="myform" autocomplete="off">
        <input type="hidden" value="{$object.userId}" id="userId"/>
        <input type="hidden" value="{$object.userType}" id="userType"/>

        <tr>
            <th align='right'>余额<font color='red'>*</font>：</th>
            <td>
                <input type='text' id='userMoney' disabled="disabled" class="form-control wst-ipt-10"  value='{$object.userMoney}'  maxLength='8'/>
            </td>
        </tr>
        <tr>
            <th align='right'>添加余额<font color='red'>*</font>：</th>
            <td colspan='2'>
                <input type='text' id='addMoney' class="form-control wst-ipt-10"  maxLength='8'/>
            </td>
        </tr>

        <tr>
            <th align='right'>减少余额<font color='red'>*</font>：</th>
            <td colspan='2'>
                <input type='text' id='ReduceMoney' class="form-control wst-ipt-10"  maxLength='8'/>
            </td>
        </tr>

        <tr>
            <td colspan='3' style='padding-left:250px;'>
                <button type="submit" class="btn btn-success">保&nbsp;存</button>
                <button type="button" class="btn btn-primary" onclick='javascript:location.href="{:U('Admin/Users/index')}"'>返&nbsp;回</button>
            </td>
        </tr>
    </table>
</form>
</body>
</html>